import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;


public class HttpResponse implements Response {

	private Socket socket;
	Map<String,String> map=new HashMap<String,String>();
	int status=0;
	public HttpResponse(Socket socket) {
		this.socket = socket;
	}@Override
	public void init() {

	}

	@Override
	public void addHeader(String key, String value) {
		map.put(key, value);
	}

	@Override
	public void setStatus(int status) {
		this.status=status;
	}

	@Override
	public PrintWriter getWriter() {
		OutputStream outputStream;
		try {
			outputStream = socket.getOutputStream();
			PrintWriter pw=new PrintWriter(outputStream,true);
			return pw;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public OutputStream getOutputStream() {
		try {
			return socket.getOutputStream();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

}
